from time import time
fin_m1 = open("m1_sorted.txt")
fin_m2 = open("m2_reverse.txt")
fin_m3 = open("m3_shuffle.txt")
m1 = list(map(int,fin_m1.read().split()))
m2 = list(map(int,fin_m2.read().split()))
m3 = list(map(int,fin_m3.read().split()))
def bubble_sort(a):
    flag = True
    while flag:
        flag = False
        for i in range(len(a)-1):
            if a[i]>a[i+1]:
                a[i],a[i+1] = a[i+1],a[i]
                flag = True
    return a
t_start = time()
ans_m1 = bubble_sort(m1)
t_end = time()
t_m1 = (t_end -t_start)*1000
print(f"m1_sorted {t_m1:.0f} milliseconds")

t_start = time()
ans_m2 = bubble_sort(m2)
t_end = time()
t_m2 = (t_end -t_start)*1000
print(f"m2_reverse {t_m2:.0f} milliseconds")

t_start = time()
ans_m3 = bubble_sort(m3)
t_end = time()
t_m3 = (t_end -t_start)*1000
print(f"m3_shuffle {t_m3:.0f} milliseconds")